home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / pcw.zip / DEMO_B.C < prev    next >
C/C++ Source or Header  |  1991-12-28  |  2KB  |  51 lines

  1. /***************************************************************/
  2. /* File Id.                     DEMO_B.C.                      */
  3. /* Author.                      Stan Milam.                    */
  4. /* Date Written.                21 Dec. 91.                    */
  5. /*                                                             */
  6. /* This program creates an advertisment for the C language us- */
  7. /* a window that moves around on the screen.                   */
  8. /*                                                             */
  9. /***************************************************************/
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <time.h>
  14. #include "pcwproto.h"
  15.  
  16. #define  rnd(x) (rand() % (x))
  17. int demo_b (void) {
  18.  
  19.    WNDPTR *wnd;
  20.    time_t timer;
  21.    int tl, bl, wr, wc, lcv, ch;
  22.    int mxr, mxc;
  23.    static char *msg[] = {
  24.       "Welcome to C",
  25.       "The Powerful Language",
  26.       "for",
  27.       "Major Applications Software",
  28.       NULL
  29.    };
  30.  
  31. /* Create a box with a advertisment for the C language */
  32.  
  33.    get_cursor_size(&tl,&bl);
  34.    set_cursor_size(0,0);
  35.    chk_video_state(&mxr,&mxc);
  36.    bordercolor(YELLOW,BLUE);
  37.    wnd = wframe(7,19,15,60,LIGHTGRAY,BLUE);
  38.    q_block_write(9,CENTER,LIGHTGRAY,BLUE,msg);
  39.    time(&timer); srand(timer); ch = keywait(3);
  40.    for (lcv = 0; lcv < 10 && ch != 27; lcv++) {
  41.        wr = rnd(mxr)+1; wc = rnd(mxc)+1;
  42.        if ( mpresent ) hide_mouse();
  43.        wndmove(wnd,wr,wc);
  44.        if ( mpresent ) show_mouse();
  45.        ch = keywait(3);
  46.    }
  47.    wpop(wnd); set_cursor_size(tl,bl);
  48.    return 0;
  49. }
  50.  
  51.